package com.ck.daoImpl;

import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.ck.dao.SubjectDAO;
import com.ck.domain.Subject;

public class SubjectDAOImpl extends SqlMapClientDaoSupport implements SubjectDAO {

	public List<Subject> getAllSubject() {
		return (List<Subject>)getSqlMapClientTemplate().queryForList("getAllSubject");
	}

	public Subject getSubjectById(Integer id) {
		return (Subject) getSqlMapClientTemplate().queryForObject("getSubjectById",id);
	}

	public Subject getSubjectByName(String name) {
		return (Subject) getSqlMapClientTemplate().queryForObject("getSubjectByName",name);
	}
	
	public void addNewSubject(Subject subject) {
		getSqlMapClientTemplate().insert("addNewSubject", subject);
	}

	public void updateSubjectInfo(Subject subject) {
		getSqlMapClientTemplate().update("updateSubjectInfo", subject);
	}

}
